package com.school.graduation.common.base;

import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;
import android.view.WindowManager;

import butterknife.ButterKnife;

public abstract class BaseActivity extends FragmentActivity {

    public Context context = this;
    public final String TAG = context.getClass().getName();

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getContentView());
        ButterKnife.bind(this);
        initData();
        initState();  //实现沉浸式状态栏
    }

    private void initState() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            //透明状态栏
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        }
    }

    //获取当前页面需要绑定的视图id
    public abstract int getContentView();

    //做初始化
    public abstract void initData();

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }
}
